function PlotCR3BPSunEarth_EarthCenterView_Multiple(InitialConditions,OrbitalPeriods,u,Sizes)
options=odeset('RelTol',1e-20,'AbsTol',1e-50);
%[] Increase integration options

warning('off')
%[] Turn off warning

for ii = 1:length(OrbitalPeriods)
    [t{ii},S{ii}] = ode113(@(t,S)CR3BP_n(t,S,u),...
        linspace(0,OrbitalPeriods(ii)*2,300),InitialConditions(:,ii),options);
    %[] integrate states
    
    t{ii} = t{ii}';
    %[] Transpose time
    
    S{ii} = S{ii}';
    %[] Transpose state
end

r12 = 1.496*10^8;
%[km]Distance between the Sun and the Earth.

Re = 6378.136 / r12;
%[]Normalized mean equatorial radius of the Earth.

% Rm = 1737.000 / r12;
%[]Normalized mean equatorial radius of the Moon.

[xe,ye,ze] = ellipsoid(1-u,0,0,Re,Re,Re,100);
%[]Coordinates for the Earth.

Earth = imread('Earth.bmp');
%[]Loads the image of the Moon.

for ii = 1:length(OrbitalPeriods)
    
    Rsat{ii} = S{ii}(1:3,:);
    Vsat{ii} = S{ii}(4:6,:);
    %[]Satellite positions WRT the CM in ECI coordinates.
    
end

[L1, L2, L3, L4, L5]=librationPoints(u);
%[] Calculate lagrange points position


ScreenSize = get(0,'ScreenSize');
%[]Determines the location and dimensions of the current monitor.

Window = figure( ...
    'Color','w', ...
    'Name','CIRCULAR RESTRICTED THREE-BODY PROBLEM', ...
    'NumberTitle','Off', ...
    'OuterPosition',ScreenSize);
%[]Opens a new window and adjusts its properties.

n = size(Rsat{1},2);
%[]Number of points that will be plotted.

Extent = 1.3;
%[] Extent axis.

Axes = axes(...
'CameraPosition',[1,0,0.5], ...
'CameraTarget',[1,0,0],...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'NextPlot','Add', ...
    'Parent',Window, ...
    'PlotBoxAspectRatio',[1,1,1], ...
    'XGrid','On', ...
    'YGrid','On', ...
    'ZGrid','On');
%[]Adds an axes to the specified window and adjusts its properties.

axis equal
%[] make axis equal in x, y and z

surface(xe,ye,-ze, ...
    'CData',Earth, ...
    'EdgeColor','None', ...
    'FaceColor','TextureMap', ...
    'Parent',Axes);
%[]Adds a plot to the specified axes and adjusts its properties.

CellNumber = 1;
%[] Cell number

for jj = Sizes
    
    Switching = 1;
    %[] Switching
    
    colors = [rand, rand, rand];
    %[] make new colors
    
    while Switching <= jj
        
        plot3(Rsat{CellNumber}(1,:),Rsat{CellNumber}(2,:),Rsat{CellNumber}(3,:), ...
            'Color',colors, ...
            'LineStyle','-', ...
            'Marker','.', ...
            'MarkerSize',1,...
            'Parent',Axes);
        %[] Adds a plot to the specified window and adjusts its properties.
        
        Switching = Switching + 1;
        CellNumber = CellNumber + 1;
        %[] Increment switching and cell number
        
    end
end

plot(L1(1),L1(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',5, ...
    'Parent',Axes);
%[]Plots the position of L1 and adjusts its properties.

plot(L2(1),L2(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',5, ...
    'Parent',Axes);
%[]Plots the position of L2 and adjusts its properties.

title( ...
    'SATELLITE ORBIT IN THE CR3BP', ...
    'FontSize',20, ...
    'Parent',Axes);
%[]Adds a title to the specified axes and adjusts its properties.

xlabel( ...
    '\chi_x', ...
    'FontSize',16, ...
    'Parent',Axes);
%[]Adds a label to the specified x-axis and adjusts its properties.

ylabel( ...
    '\chi_y', ...
    'FontSize',16, ...
    'Parent',Axes);
%[]Adds a label to the specified y-axis and adjusts its properties.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L1(1),-0.001], ...
    'String','L_1');
%[]Adds a textbox to the specified axes.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L2(1),-0.001], ...
    'String','L_2');
%[]Adds a textbox to the specified axes.
end

